<template>
  <j-modal
    :footer="false"
    title="详细信息"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
    okText="确认"
    >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">

<!--        <a-form-item label="申报类别" :labelCol="labelCol" :wrapperCol="wrapperCol" >-->
<!--          <j-category-select-->
<!--            v-decorator="['professorDeclareCategory']"-->
<!--            pcode="B03"-->
<!--            multiple-->
<!--            :disabled="true"-->
<!--          />-->
        </a-form-item>
        <a-form-item label="学生姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input v-decorator="['professorName']" placeholder="请输入专家姓名" :disabled="true"></a-input>
        </a-form-item>
        <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <j-dict-select-tag type="list" v-decorator="['professorSex']" :disabled="true" :trigger-change="true" dictCode="sex" placeholder="请选择专家性别"/>
        </a-form-item>
        <a-form-item label="请假时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <j-date placeholder="请选择请假时间" v-decorator="['professorBirthday']" :disabled="true" :trigger-change="true" style="width: 100%"/>
        </a-form-item>
        <a-form-item label="请假天数" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input placeholder="请输入请假时间" :disabled="true" :v-text='11'></a-input>
        </a-form-item>
        <a-form-item label="学校" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <!--<j-dict-select-tag type="list" v-decorator="['professorSchool']" :trigger-change="true" dictCode="" placeholder="请选择毕业院校"/>-->
          <a-input v-decorator="['professorSchool']" placeholder="请选择毕业院校" :disabled="true"/>
        </a-form-item>
        <a-form-item label="专业" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <!--<j-tree-select
            v-model="marjorId"
            placeholder="请选择专业"
            dict="major,name,id"
            pidField="parentId"
            v-decorator="['professorMajor']"
            :disabled="true">
          </j-tree-select>-->
          <a-input v-decorator="['professorMajor']" placeholder="请选择毕业院校" :disabled="true"/>
        </a-form-item>
        <a-form-item label="预计回来时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <j-date placeholder="请选择毕业时间" v-decorator="['professorGraduateDate']" :disabled="true" :trigger-change="true" style="width: 100%"/>
        </a-form-item>
<!--        <a-form-item label="学历" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorEducationBackground']" :disabled="true" placeholder="请输入学历"></a-input>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="学位" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorDegree']" placeholder="请输入学位" :disabled="true"></a-input>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="工作单位" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorWorkUnit']" placeholder="请输入工作单位" :disabled="true"></a-input>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="家庭地址" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorAddress']" placeholder="请输入通讯地址" :disabled="true"></a-input>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="职务" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorPosition']" :disabled="true"  placeholder="请选择职务"/>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="参加工作时间" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-date placeholder="请选择参加工作时间" v-decorator="['professorBeginWork']" :disabled="true" :trigger-change="true" style="width: 100%"/>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="技术职称" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorTitle']" :disabled="true" placeholder="请选择技术职称"/>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="从事专业" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorWorkMajor']" placeholder="请输入从事专业" :disabled="true"></a-input>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="从事专业时间" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-date placeholder="请选择从事专业时间" v-decorator="['professorMajorDate']" :disabled="true" :trigger-change="true" style="width: 100%"/>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="身份证号" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-input v-decorator="['professorIdentity']" placeholder="请输入身份证号" :disabled="true"></a-input>-->
<!--        </a-form-item>-->
        <a-form-item label="家庭地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input v-decorator="['professorHomeAddress']" :disabled="true" placeholder="请输入家庭地址"/>
        </a-form-item>
        <a-form-item label="健康状况" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input v-decorator="['professorHealth']" :disabled="true" placeholder="请选择健康状况"/>
        </a-form-item>
        <a-form-item label="家庭电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input v-decorator="['professorOfficeTel']" placeholder="请输入办公电话" :disabled="true"></a-input>
        </a-form-item>
        <a-form-item label="手机" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input v-decorator="['professorPhone']" placeholder="请输入手机" :disabled="true"></a-input>
        </a-form-item>
        <a-form-item label="请假原因" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-textarea v-decorator="['professorProjectIntroduce']" :disabled="true" rows="4" placeholder="请输入本人项目简介"/>
        </a-form-item>
<!--        <a-form-item label="业务主管 部门" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <a-textarea v-decorator="['professorLeadMsg']" rows="4" :disabled="true" placeholder="请输入业务主管 部门"/>-->
<!--        </a-form-item>-->
        <a-form-item label="老师意见" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-textarea v-decorator="['professorApproveMsg']" rows="4" :disabled="true" placeholder="请输入行政审批局意见"/>
        </a-form-item>
<!--        <a-form-item label="附件照片" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload isMultiple v-decorator="['professorPhotoString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="申请表照片" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload  v-decorator="['professorInfoPhotoString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="身份证复印件" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload v-decorator="['professorIdString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="个人承诺书" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload v-decorator="['professorCommitmentString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="个人工作简历" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload multiple isMultiple showUploadList  v-decorator="['professorResumeString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="学历、学位证书复印件" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload multiple isMultiple showUploadList  v-decorator="['professorDegreeImageString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="专业资格职业证书复印件" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload multiple isMultiple showUploadList  v-decorator="['professorQualificationString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
<!--        <a-form-item label="其他证明专业能力的材料" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!--          <j-image-upload multiple isMultiple showUploadList  v-decorator="['professorOtherString']" :disabled="true"></j-image-upload>-->
<!--        </a-form-item>-->
      </a-form>
    </a-spin>
  </j-modal>
</template>

<script>

  import { httpAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import JDate from '@/components/jeecg/JDate'
  import JImageUpload from '@/components/jeecg/JImageUpload'
  import JDictSelectTag from "@/components/dict/JDictSelectTag"
  import JCategorySelect from '@/components/jeecg/JCategorySelect'
  import JAreaLinkage from '@comp/jeecg/JAreaLinkage'


  export default {
    name: "DiyProfessorInfoModal",
    components: {
      JDate,
      JImageUpload,
      JDictSelectTag,
      JAreaLinkage,
      JCategorySelect,
    },
    data () {
      return {
        marjorId:"",
        form: this.$form.createForm(this),
        width:1000,
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
        },
        url: {
          add: "/org/diyProfessorInfo/add",
          edit: "/org/diyProfessorInfo/edit",
        }
      }
    },
    created () {
    },
    methods: {
      add () {
        this.edit({});
      },
      edit (record) {
        this.form.resetFields();
        this.model = Object.assign({}, record);
        this.visible = true;
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'professorOtherString','professorQualificationString','professorDegreeImageString','professorResumeString','professorCommitmentString','professorIdString','professorInfoPhotoString','professorName','professorSex','professorBirthday','professorSchool','professorMajor','professorGraduateDate','professorEducationBackground','professorDegree','professorWorkUnit','professorAddress','professorDeclareCategory','professorPosition','professorBeginWork','professorTitle','professorWorkMajor','professorMajorDate','professorIdentity','professorHomeAddress','professorHealth','professorOfficeTel','professorPhone','professorProjectIntroduce','professorLeadMsg','professorApproveMsg','professorPhotoString'))
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
/*      handleOk () {
        const that = this;
        // 触发表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
              method = 'put';
            }
            let formData = Object.assign(this.model, values);
            console.log("表单提交数据",formData)
            httpAction(httpurl,formData,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })
          }

        })
      },*/
      handleCancel () {
        this.close()
      },
      popupCallback(row){
        this.form.setFieldsValue(pick(row,'professorOtherString','professorQualificationString','professorDegreeImageString','professorResumeString','professorCommitmentString','professorIdString','professorInfoPhotoString','professorName','professorSex','professorBirthday','professorSchool','professorMajor','professorGraduateDate','professorEducationBackground','professorDegree','professorWorkUnit','professorAddress','professorDeclareCategory','professorPosition','professorBeginWork','professorTitle','professorWorkMajor','professorMajorDate','professorIdentity','professorHomeAddress','professorHealth','professorOfficeTel','professorPhone','professorProjectIntroduce','professorLeadMsg','professorApproveMsg','professorPhotoString'))
      },
      handleCategoryChange(value,backObj){
        this.form.setFieldsValue(backObj)
      }


    }
  }
</script>